# coding: utf-8
from . import db, BaseModel


class Article(db.Model):
    __tablename__ = 'article'

    auto_id = db.Column(db.BigInteger, primary_key=True, info='自增id')
    article_id = db.Column(db.BigInteger, nullable=False, info='文章id')
    publisher_id = db.Column(db.BigInteger, nullable=False, info='发布者id')
    title = db.Column(db.String(50, 'utf8mb4_0900_ai_ci'), nullable=False, server_default=db.FetchedValue(), info='文章标题')
    content = db.Column(db.Text(collation='utf8mb4_0900_ai_ci'), nullable=False, info='内容')
    hits = db.Column(db.Integer, nullable=False, server_default=db.FetchedValue(), info='点击人数')
    review_status = db.Column(db.Integer, nullable=False, server_default=db.FetchedValue(), info='审核状态 0-待通过 1-已通过 2-已驳回 ')
    pic_url = db.Column(db.String(255, 'utf8mb4_0900_ai_ci'), nullable=False, server_default=db.FetchedValue(), info='图片url')
    publish_time = db.Column(db.DateTime, nullable=False, server_default=db.FetchedValue(), info='发布时间')
    is_recommend = db.Column(db.Integer, nullable=False, server_default=db.FetchedValue(), info='推荐位')
    is_delete = db.Column(db.Integer, nullable=False, server_default=db.FetchedValue(), info='逻辑删除')
    create_time = db.Column(db.DateTime, nullable=False, server_default=db.FetchedValue(), info='创建时间')
    update_time = db.Column(db.DateTime, nullable=False, server_default=db.FetchedValue(), info='更新时间')
